package tooltest;

import java.io.IOException;
import java.util.Calendar;
import java.util.Random;

import org.junit.Test;

import com.lyq.Tool;

import jxl.read.biff.BiffException;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;

public class testtool
{
	
	
	@Test
	public void testWriteAnswewrsToExcle() throws RowsExceededException, BiffException, WriteException, IOException
	{
		String strings1[] = new String[4];
		strings1[0]="userName";
		strings1[1]="xuehao";
		strings1[2]="44";
		strings1[3]="2019883";
		
		String answerC = "";
		String answerG = "";
		
		int[] questionNo = new int[100];
		
		for (int i = 0; i < 100; i++)
		{
			answerC += "A";
		}
		
		for (int j = 0; j < 100; j++)
		{
			answerG += "B";
		}
		
		Random random = new Random();
		
		for(int i =0; i<100; i++)
		{
			questionNo[i] = random.nextInt(99)+1;
			
		}
		
		Tool.writeAnswewrsToExcle(strings1, answerC,answerG,questionNo);
		
		
		
		
		
		
		
		
		
		
		
		
		
	}
	
	
	
	
	
	
	
	
	
	
	@Test
	public void testwriteExcel()
			throws WriteException, IOException, BiffException
	{
		/*
		 * File file = new File("E:/gg88.xls");
		 * 
		 * // file.createNewFile();
		 * 
		 * FileOutputStream fos = new FileOutputStream(file);
		 */
		//
		//
		String[] resultStrings1 = new String[4];

		// resultStrings1[0] = "aa";
		// resultStrings1[1] = "bb";
		// resultStrings1[2] = "cc";

		resultStrings1[0] = "ee";
		resultStrings1[1] = "tt";
		resultStrings1[2] = "tyy";

		Calendar calendar = Calendar.getInstance();

		int year = calendar.get(Calendar.YEAR);
		int month = calendar.get(Calendar.MONTH);
		int day = calendar.get(Calendar.DAY_OF_MONTH);
		int hour = calendar.get(Calendar.HOUR);
		int minute = calendar.get(Calendar.MINUTE);
		int second = calendar.get(Calendar.SECOND);

		resultStrings1[3] = year + "-" + month + "-" + day + " " + hour
				+ ":" + minute + ":" + second;

			Tool.writeExcle2(resultStrings1);



		// Tool.writeExcle2(null, 1);
		
		
		
		
		
		
	}

	@Test
	public void haffffh()
	{
		String a = " 错 ";
		
		String b = "错";
		
		
		
		if(a.trim().equals(b))
		{
			System.out.println("ff");
		}
		
		
		
	}


}
